package com.huidao.servlet.Goods;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.huidao.entity.Goods;
import com.huidao.service.GoodsService;
import com.huidao.service.GoodsServiceImp;


public class UpdateGoodsStatusServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       

    public UpdateGoodsStatusServlet() {
        super();
        // TODO Auto-generated constructor stub
    }


	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Goods goods = new Goods();
		goods.setGid(Long.parseLong(request.getParameter("id")));
		goods.setgShelves(Integer.parseInt(request.getParameter("gShelves")) );
		GoodsService gs = new GoodsServiceImp();
		if(gs.updateStatusGoods(goods).equals("")){
			request.getRequestDispatcher("sellergoodslist.jsp").forward(request, response);
		}
		response.getWriter().print(gs.updateStatusGoods(goods));
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	}

}
